import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SkProtocolRulesVO, SkProtocolRulesForm, SkProtocolRulesQuery } from '@/api/app/SkProtocolRules/types';

/**
 * 查询协议规则列表
 * @param query
 * @returns {*}
 */

export const listSkProtocolRules = (query?: SkProtocolRulesQuery): AxiosPromise<SkProtocolRulesVO[]> => {
  return request({
    url: '/app/SkProtocolRules/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询协议规则详细
 * @param id
 */
export const getSkProtocolRules = (id: string | number): AxiosPromise<SkProtocolRulesVO> => {
  return request({
    url: '/app/SkProtocolRules/' + id,
    method: 'get'
  });
};

/**
 * 新增协议规则
 * @param data
 */
export const addSkProtocolRules = (data: SkProtocolRulesForm) => {
  return request({
    url: '/app/SkProtocolRules',
    method: 'post',
    data: data
  });
};

/**
 * 修改协议规则
 * @param data
 */
export const updateSkProtocolRules = (data: SkProtocolRulesForm) => {
  return request({
    url: '/app/SkProtocolRules',
    method: 'put',
    data: data
  });
};

/**
 * 删除协议规则
 * @param id
 */
export const delSkProtocolRules = (id: string | number | Array<string | number>) => {
  return request({
    url: '/app/SkProtocolRules/' + id,
    method: 'delete'
  });
};
